<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Szy1000</title>
	<script>
		window.onload=function(){
			var play=document.getElementById('play');
			var mute=document.getElementById('mute');
			var bgm=document.getElementById('bgMusic');
			play.onclick=function(){
				if(bgm.paused){
					bgm.play()
	        play.value="播放";
				}else{
					bgm.pause();
	        play.value="暂停";
				}
			}

			mute.onclick=function(){
				if(bgm.paused){
					return;
				}else{
					if(bgm.muted){
						bgm.muted = false;
						mute.value="外音";
					}else{
						bgm.muted = true;
						mute.value="静音";
					}
				}
			}

		}
	</script>
</head>
<body>
	<p><a href="#">javascript</a></p>
	<p><a href="jquery.html">jquery版本</a></p>
	<h2>javascript</h2>
	<input type="button" value="播放" id="play">
	<input type="button" value="静音" id="mute">
	<audio id="bgMusic" >
    <source src="music/bgm.mp3" type="audio/mp3">
    <source src="music/bgm.ogg" type="audio/ogg">
	</audio>
</body>
</html>